﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


/*
跟随玩家
 */
public class FollowPlayer : MonoBehaviour {
	private Transform player;
	private Vector3 pos;

	void Awake(){
		player = GameObject.Find("Hero").transform;
	}


	void Update () {
		if(!PlayerController.instance.isDeath){
			pos = transform.position;
			pos.x = player.position.x;
			pos.y = player.position.y;
			transform.position = pos;
		}else{
			pos = this.transform.position;
			pos.x = this.transform.position.x;
			pos.y = this.transform.position.y;
			transform.position = pos;
		}
		
	}
}
